﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using HouseKeepingPL.HKService;
using System.Threading;
using GalaSoft.MvvmLight;

namespace HouseKeepingPL.ViewModel
{
    public static class ClientProxy
    {
    	private static ServicesClient _proxy;
		private static readonly object _lockObj = new object();

        public static ServicesClient Proxy
        {
            get
            {
                if (ViewModelBase.IsInDesignModeStatic) return null;
                if (_proxy == null)
                {
                    lock (_lockObj)
                    {
                        Thread.MemoryBarrier();
                        if (_proxy == null)
                        {
                            _proxy = new ServicesClient();
                        }
                    }
                }
                return _proxy;
            }
        }
    }
}
